package com.youxiake.lock;

import org.openjdk.jol.info.ClassLayout;

/**
 * @author jxbai
 * @date 2021/12/19
 */
public class BiasedLockDemo {

    private static Object o = new Object();

    public static void main(String[] args) {
        new Thread(() -> {
            synchronized (o) {
                System.out.println(ClassLayout.parseInstance(o).toPrintable());
            }
        }, "t1").start();
        new Thread(() -> {
            synchronized (o) {
                System.out.println(ClassLayout.parseInstance(o).toPrintable());
            }
        }, "t2").start();

        new Thread(() -> {
            synchronized (o) {
                System.out.println(ClassLayout.parseInstance(o).toPrintable());
            }
        }, "t3").start();

        new Thread(() -> {
            synchronized (o) {
                System.out.println(ClassLayout.parseInstance(o).toPrintable());
            }
        }, "t4").start();

    }
}
